// .txt

beginzonescript;

variables;

short crime_tolerance = 5;
short last_abil;
short i;

body;

beginstate INIT_STATE;
	sf(41,22,0);
	
	set_name(8,"Commander Illyara");
	set_boss_level(8,1);
	
	set_name(9,"Bellock");
	set_name(10,"Trahan");
	set_level(10,28);
	set_boss_level(10,1);
	if (gf(41,2) > 0)
		erase_char(10);
		
	set_name(11,"Bryony");
	set_name(12,"Bartol");
	set_name(13,"Mukesh");
	set_name(14,"Preva");
	if ((gf(41,11) > 0) || (gf(41,12) > 1))
		erase_char(14);
	set_name(15,"Dinara");
	set_name(16,"Warzana");
	set_name(17,"Servant Alpha");
	set_name(18,"Trained Artila");
	set_level(17,18);
	set_level(18,19);
	

	add_range_to_group(19,23,1);
	set_name(1001,"Merchant");

	set_name(24,"Refugee");
	set_name(25,"Refugee");
	set_name(26,"Refugee");

	set_name(57,"Barge Worker");
	set_name(58,"Barge Worker");
	
	if (gf(100,11) > 0) {
		print_str_color("Word of your infamy has gotten here before you. You are forever marked",3);
		print_str_color("  as a foe of the Shapers.",3);
		sf(41,3,1);
		}
	if (get_sdf(41,3) > 0) {
		make_zone_hostile();
		}
		else {
			print_str_color("This is a friendly city. You are able to rest.",2);
			revive_party();
			}	

	last_abil = get_current_tick();
	
	set_crime_tolerance(crime_tolerance);
	
	// creation missing check
	if ((gf(41,19) == 2) && (char_in_party(829) < 0))
		sf(41,19,3);
	if ((gf(41,20) == 2) && (char_in_party(830) < 0))
		sf(41,20,3);
	if ((char_in_party(829) >= 0) || (gf(41,19) >= 2))
		erase_char(17);
	if ((char_in_party(830) >= 0) || (gf(41,20) >= 2))
		erase_char(18);
	break;

beginstate EXIT_STATE;

break;

beginstate START_STATE;
	if ((gf(41,3) > 0) && (gf(100,3) == 2)) {
		sf(100,3,3);
		print_str_color("Now that Perikalia is angry with you, you will no longer be",3);
		print_str_color("  able to serve Alwan.",3);
		}

	// trahan death flag
	if ((gf(41,2) == 0) && (char_ok(10) == FALSE)) {
		sf(41,2,2);
		}

	// creation missing check
	if ((gf(41,19) == 2) && (char_in_party(829) < 0))
		sf(41,19,3);
	if ((gf(41,20) == 2) && (char_in_party(830) < 0))
		sf(41,20,3);
		
	// clear zone?
	//if ((zone_clear(ME) == FALSE) && (get_flag(,) > 0)) {
		//print_str_color("",2);
		//clear_zone(ME);	
		//}
		
	if ((get_crime_level() >= crime_tolerance) && (get_sdf(41,3) == 0)) {
		make_zone_hostile();
		set_flag(41,3,1);
		}

	if (gf(41,3) == 0) {
		if ((get_ran(1,0,100) < 30) && (gf(41,6) == 0))
			give_char_text_bubble(8,"We must talk.");
		if ((get_ran(1,0,100) < 10) && (gf(41,6) > 0))
			give_char_text_bubble(8,"You may work for me.");
		if ((get_ran(1,0,100) < 10) && (gf(41,6) > 0))
			give_char_text_bubble(8,"I have information.");
		if ((get_ran(1,0,100) < 10) && (gf(41,6) > 0))
			give_char_text_bubble(8,"We are strict here.");
		if ((get_ran(1,0,100) < 10) && (gf(41,6) > 0))
			give_char_text_bubble(8,"We give Alwan's justice.");
		if ((get_ran(1,0,100) < 10) && (gf(41,14) < 2))
			give_char_text_bubble(9,"I require aid.");
		if ((get_ran(1,0,100) < 10) && (gf(41,14) < 2))
			give_char_text_bubble(9,"I can pay well.");
		if ((get_ran(1,0,100) < 10) && (gf(41,14) < 2))
			give_char_text_bubble(9,"A moment of your time.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10,"Over here! Quickly!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10,"We must be quiet.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(10,"We are of a kind.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(11,"Be patient!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(11,"I'm coming!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(11,"Need anything, traveler?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(12,"Sniff.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(12,"Hmmph.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(12,"Natural goods only.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(12,"No Shaped items here.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(13,"Greetings.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(13,"Care to see a blade?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(13,"Examine our armor.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14,"Sweep.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(14,"Sweep. Sweep.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(15,"Work faster!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(15,"Be careful!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(15,"No! Not like that.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(15,"Adequate job.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(16,"Need more help?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(16,"Care for a creation?");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(16,"Only a small feeding fee.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(19 + get_ran(1,0,4),"I bid fifty.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(19 + get_ran(1,0,4),"Six each, and no higher.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(19 + get_ran(1,0,4),"It's a deal.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(19 + get_ran(1,0,4),"No deal!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(19 + get_ran(1,0,4),"You are a cheat!");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(19 + get_ran(1,0,4),"That is fair. Barely.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(59 + get_ran(1,0,2),"Chip. Chip.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(59 + get_ran(1,0,2),"Tap. Tap. Tap.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(59 + get_ran(1,0,2),"Rub. Rub.");
		if (get_ran(1,0,100) < 10)
			give_char_text_bubble(59 + get_ran(1,0,2),"Tik. Tik. Tik.");

		}
	
	if (((is_combat()) && (tick_difference(last_abil,get_current_tick()) > 0)) || ((is_group()) && (tick_difference(last_abil,get_current_tick()) > 17))) {
		
		if (gf(41,21) == 0)
			sf(41,21,1);
			else sf(41,21,0);
			
		last_abil = get_current_tick();
		}
break;

beginstate 10;
	set_terrain_string_range("The sign says - COMMANDER'S OFFICE.",3);
break;

beginstate 11;
	set_terrain_string_range("The sign says - City Watch Barracks.",3);
break;

beginstate 12;
	set_terrain_string_range("The sign says - The White Stag Inn.",3);
break;

beginstate 13;
	set_terrain_string_range("The sign says - Artisinal Iron.",3);
break;

beginstate 14;
	set_terrain_string_range("The sign says - Perikalia Crystal Works.",3);
break;

beginstate 15;
	set_terrain_string_range("The sign says - Bartol's Natural Goods.",3);
break;

beginstate 16;
	set_terrain_string_range("The sign says - Hanover's Crafts. CLOSED.",3);
break;

beginstate 17;
	set_terrain_string_range("The sign says - Merchant Storage. KEEP OUT.",3);
break;

beginstate 18;
	set_terrain_string_range("The sign says - CREATION CARE AND RENTAL.",3);
break;

//	print_str("");
//	set_terrain_string_range(".",3);
//	set_terrain_string_range("The sign says - .",3);
